package com.cqut.forum.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author yangxun
 * UserNews entity
 */
@Entity
@Table(name = "user_news", catalog = "forum")
public class UserNews implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer userNewsId;
	private User user;
	private Integer moduleId;
	//private Integer newsId;
	private Boolean isSystemNews;
	private String newsContents;
	private Integer acceptUserId;
	private Date newsTime;
	private Boolean userNewsState;
	//private Integer previousNewsId;
	// Constructors

	/** default constructor */
	public UserNews() {
	}

	/** full constructor */
	public UserNews(Integer moduleId, Integer newsId,User user,
			Boolean isSystemNews, String newsContents,/*Integer previousNewsId,*/
			Integer acceptUserId, Date newsTime, Boolean userNewsState) {
		//this.user = user;
		this.moduleId = moduleId;
		this.user = user;
		//this.newsId = newsId;
		this.isSystemNews = isSystemNews;
		this.newsContents = newsContents;
		this.acceptUserId = acceptUserId;
		this.newsTime = newsTime;
		this.userNewsState = userNewsState;
		//this.previousNewsId = previousNewsId;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "user_news_id", unique = true, nullable = false)
	public Integer getUserNewsId() {
		return this.userNewsId;
	}

	public void setUserNewsId(Integer userNewsId) {
		this.userNewsId = userNewsId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Column(name = "module_id")
	public Integer getModuleId() {
		return moduleId;
	}

	public void setModuleId(Integer moduleId) {
		this.moduleId = moduleId;
	}

	/*@Column(name = "table_name", length = 20)
	public String getTableName() {
		return this.tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	@Column(name = "news_id")
	public Integer getNewsId() {
		return this.newsId;
	}

	public void setNewsId(Integer newsId) {
		this.newsId = newsId;
	}
*/
	@Column(name = "is_system_news")
	public Boolean getIsSystemNews() {
		return this.isSystemNews;
	}

	public void setIsSystemNews(Boolean isSystemNews) {
		this.isSystemNews = isSystemNews;
	}

	@Column(name = "news_contents", length = 500)
	public String getNewsContents() {
		return this.newsContents;
	}

	public void setNewsContents(String newsContents) {
		this.newsContents = newsContents;
	}
	@Column(name = "accept_user_id")
	public Integer getAcceptUserId() {
		return acceptUserId;
	}

	public void setAcceptUserId(Integer acceptUserId) {
		this.acceptUserId = acceptUserId;
	}

	@Column(name = "news_time", length = 10)
	public Date getNewsTime() {
		return this.newsTime;
	}

	public void setNewsTime(Date newsTime) {
		this.newsTime = newsTime;
	}
	@Column(name = "user_news_state")
	public Boolean getUserNewsState() {
		return userNewsState;
	}

	public void setUserNewsState(Boolean userNewsState) {
		this.userNewsState = userNewsState;
	}

/*	@Column(name = "previous_news_id")
	public Integer getPreviousNewsId() {
		return previousNewsId;
	}

	public void setPreviousNewsId(Integer previousNewsId) {
		this.previousNewsId = previousNewsId;
	}
*/
}